package com.tutu.service.impl;

import com.tutu.dao.StudentDao;
import com.tutu.entity.Student;
import com.tutu.service.StudentService;

import java.util.List;

/**
 * @Program: Spring_New
 * @Description:
 * @Author: JK.TuTu
 * @Create: 2022-09-14 21:51
 **/
public class StudentServiceImpl implements StudentService {
    //定义一个dao类型属性
    private StudentDao studentDao;
    /**
     * 定义set方法，使用set注入来给dao属性赋值
     */
    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    @Override
    public int addStudent(Student student) {
        return studentDao.insertStudent(student);
    }
    @Override
    public List<Student> findAllStudent() {
        return studentDao.selectAllStudent();
    }
    @Override
    public int removeStudent(Integer id) {
        return studentDao.deleteStudent(id);
    }
}